﻿using System;
using System.Windows.Forms;

namespace Tecnorama.Yonetici
{
    public partial class mdiKabuk : Form
    {
        private int childFormNumber = 0;

        public mdiKabuk()
        {
            InitializeComponent();
        }

        private void ShowNewForm(object sender, EventArgs e)
        {
            Anaform form1 = new Anaform();
            form1.MdiParent = this;
            form1.Text = "Özet" + childFormNumber++;
            form1.Show();
        }

        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = openFileDialog.FileName;
            }
        }

        private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            saveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = saveFileDialog.FileName;
            }
        }

        private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CutToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void CopyToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void PasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void ToolBarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            toolStrip.Visible = toolBarToolStripMenuItem.Checked;
        }

        private void StatusBarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            statusStrip.Visible = statusBarToolStripMenuItem.Checked;
        }

        private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.Cascade);
        }

        private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileVertical);
        }

        private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.ArrangeIcons);
        }

        private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form childForm in MdiChildren)
            {
                childForm.Close();
            }
        }

        private void mdiKabuk_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            Anaform form = new Anaform();
            form.MdiParent = this;
            form.Show();
            form.WindowState = FormWindowState.Maximized;
            form.trv_Personel_Agaci.Nodes[0].Expand();
        }

        private void mdiKabuk_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.OpenForms["Form1"].Show();
        }

        private void yetkiSeviyesiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmGiris frm = new frmGiris();
            frm.Text = "Yetki";
            frm.MdiParent = this;
            frm.Show();
            frm.WindowState = FormWindowState.Normal;
            formkapaac(frm, false);
            frm.BringToFront();
        }

        private void personelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmPersonel frmp = new frmPersonel();
            frmp.StartPosition = FormStartPosition.CenterParent;
            frmp.MdiParent = this;
            frmp.Show();
            formkapaac(frmp, false);
            frmp.BringToFront();
        }

        private void formkapaac(Form frm, bool a)
        {
            foreach (Form item in this.MdiChildren)
            {
                if (item != frm)
                {
                    item.Enabled = a;
                    item.WindowState = FormWindowState.Maximized;
                }
            }
        }

        private void ekleToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void şubeToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }
    }
}